﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.OracleClient;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
public partial class Admin_Thongke : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            OracleConnection con = DataConnection.TaoKetNoi();

            DataSet1 ds = new DataSet1();
            OracleDataAdapter adapter = new OracleDataAdapter("select sach.masach, sach.tensach, sach.tacgia, sach.dongia ,count(chitietdonhang.soluong) as TongSoLuongBan from sach, chitietdonhang,donhang where donhang.madonhang=chitietdonhang.madonhang and  sach.masach = chitietdonhang.masach and donhang.tinhtrang=1 GROUP BY SACH.masach, sach.tensach,sach.tacgia,sach.dongia", con);
            adapter.Fill(ds.VIEWSACHDABAN);


            ReportDocument rptDoc = new ReportDocument();
            rptDoc.Load(Server.MapPath("CrysDaban.rpt"));
            rptDoc.SetDataSource(ds);

            CrystalReportViewer1.ReportSource = rptDoc;
        }
        catch (Exception)
        {

            Response.Redirect("thongbao.aspx?ID=5");
        }
 


        



    }
}